//
//  TicketOrderViewCell.m
//  quickBatchManager
//
//  Created by 王定波 on 15/10/15.
//  Copyright © 2015年 jack. All rights reserved.
//

#import "TicketOrderViewCell.h"

@implementation TicketOrderViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)setData:(id)data
{
    if([data isKindOfClass:[BatchProductModel class]])
    {
        BatchProductModel *batchproduct=(BatchProductModel*)data;
        _label1.text=[batchproduct.createDate substringToIndex:10];
        _label2.text=[ToolUtils numberToStr:batchproduct.totalNumber];
        _label3.text=[ToolUtils priceToStr:batchproduct.totalPrice];
        _label4.text=[ToolUtils priceToStr:batchproduct.isPay==1?batchproduct.totalPrice:batchproduct.paidPrice];
        _label5.text=
        [ToolUtils priceToStr:[AppService getAmountByUserIdAndDateAndType:batchproduct.supplierId andDate:batchproduct.createDate andType:AccountTypeSupplier]];
        
        _label6.text=(batchproduct.deptPrice==0?@"":[NSString stringWithFormat:@"余额抵扣：%0.2f",batchproduct.deptPrice]);
    }
    else if([data isKindOfClass:[SaleOrderModel class]])
    {
        SaleOrderModel *order=(SaleOrderModel*)data;
        _label1.text=[order.date substringToIndex:10];
        
        if(order.clientId>0)
        {
            _label2.text=order.client.mobile;
            _label3.text=order.client.clientName;
        }else
        {
            _label2.text=order.mobile;
            _label3.text=order.clientName;

        }
        
        
        _label4.text=[ToolUtils numberToStr:order.totalNumber];
        _label5.text=[ToolUtils priceToStr:order.totalPrice];
        
        _label6.text=order.remark;
    }
    
}

@end
